package com.nowcoder.community.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "discusspost", type = "_doc", shards = 6, replicas = 3)
@Data
public class DiscussPost {
    @Id
    private int id;
    @Field(type = FieldType.Integer)
    private int userId;
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String title;
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String content;
    /**
     * 帖子类型 0-正常；1-置顶
     */
    @Field(type = FieldType.Integer)
    private int type;
    /**
     * 帖子状态 0-正常；1-精华；2-拉黑
     */
    @Field(type = FieldType.Integer)
    private int status;
    /**
     * 帖子创建时间
     */
    @Field(type = FieldType.Date)
    private Date createTime;
    /**
     * 帖子评论数量
     */
    @Field(type = FieldType.Integer)
    private int commentCount;
    /**
     * 帖子热度，用于排序
     */
    @Field(type = FieldType.Double)
    private double score;
}
